package com.softeem.springcloud.config;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @program: springcloud
 * @author: zcp_will
 * @create: 2020-09-17 10:10
 * @description
 **/
@Configuration
public class ConfigBean {

    @LoadBalanced //启用ribbon的负载均衡
    @Bean //会自动将RestTemplate设置为负载均衡模式
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }

}
